<template>
  <div class="">
    <h1>Parent</h1>
    <button @click="change">更改子组件的值</button>
    <hr />
    <Child ref="childRef" />
  </div>
</template>

<script setup>
import Child from './09-RefChild.vue'
import { ref } from 'vue'

const childRef = ref()

const change = () => {
  //   console.log('---change---', childRef.value)
  // 如果在父组件中该响应式数据，则不需要.value
  //   childRef.value.count = 200

  childRef.value.changeCount(300)
}
</script>

<style scoped></style>
